#pragma once
#include "stdafx.h"

namespace async_curl {
	class ref_counter final {
	public:
		using ref_counter_cb_t = std::function<void()>;
		using counter_t = std::atomic_int64_t;

	public:
		explicit ref_counter(ref_counter_cb_t&& cb);

		void decrease();

		~ref_counter();

		ref_counter(const ref_counter &o);

		ref_counter& operator=(const ref_counter &o);

		ref_counter(ref_counter &&o);

		ref_counter& operator=(ref_counter &&o);

	private:
		std::atomic_int64_t *counter_;
		ref_counter_cb_t cb_;
	};
}
